$(function () {
	//回复求职者
	var answerDom = $(".answer-worker");
	var answerAreaDom = $(".review-right .reply-content-wrapper:not(:animated)");
	var textareaDom = $(".review-right .reply-content-wrapper textarea");
	var closeDom = $(".close-button");
	var submitDom = $(".submit-button");
	var answerContentAreaDom = $(".answer-content");
	var alreadyReplyDom = $(".already-reply");
	var successtipsDom = $(".success-tips");
	var index = 0;
	
	answerDom.click(function () {
		index = answerDom.index($(this));
		answerAreaDom.slideUp();
		$(this).parent().siblings('.reply-content-wrapper:not(:animated)').slideDown();
	});
	
	closeDom.click(function () {
		answerAreaDom.eq(index).slideUp();
		textareaDom.eq(index).val("");
	});
	
	function tips() {
		successtipsDom.css("top","0");
		setTimeout(function () {
			successtipsDom.css("top","-45px");
		},3000);
	}
	
	submitDom.click(function () {
		var answerText = textareaDom.eq(index).val();
		var answerTextLength = answerText.length;
		if(answerText != "") {
			if(answerTextLength < 500) {
				answerAreaDom.eq(index).hide();
				answerDom.eq(index).hide();
				alreadyReplyDom.eq(index).show();
				answerContentAreaDom.eq(index).html(answerText);
				answerContentAreaDom.eq(index).parent().show();
				successtipsDom.html("回复成功！");
				tips();
			}else{
				successtipsDom.html("回复的内容不能超过500个字哦！");
				tips();
			}
		}else{
			successtipsDom.html("你回复的内容为空哟！");
			tips();
		}
	});
})
